package com.qfedu.fmmall.eureka.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @author : yanBin
 * @date :2022/1/18 10:28
 */
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        //拦截前端攻击
        http.csrf().disable();
        //设置所有服务的请求都要使用spring security的验证（账号密码）
        http.authorizeRequests().anyRequest().authenticated().and().httpBasic();
    }
}
